import request  from '@/request';
import type {addFormData , editFormData , editPermission} from "../@types";

/**获取权限列表*/
export const getPermissionList = (params : { name ?: string , page : number , pageSize : number}) => request({
    url: '/api/v2/admin/getAdminNewRoles',
    method: 'get',
    params
}) 

/**新增权限*/
export const addPermission = (data : addFormData) => request({
    url: '/api/v2/admin/addAdminNewRoles',
    method: 'post',
    data
})

/**
 * 更新权限
 * */
export const updatePermission = (data : editFormData) => request({
    url: '/api/v2/admin/updateAdminNewRoles',
    method: 'post',
    data
})

/**
 * 删除权限
 * */
export const deletePermission = (data : { ID : string }) => request({
    url: '/api/v2/admin/deleteAdminNewRoles',
    method: 'post',
    data
})

/**根据角色ID获取权限列表*/
export const getPermissionListByRoleId = (params : { ID : string}) => request({
    url: '/api/v2/admin/getMenuAndActionsByRolesIdFromEdit',
    method: 'get',
    params
}) 


/**根据角色ID更新权限列表*/
export const updatePermissionListByRoleId = (data : editPermission) => request({
    url: '/api/v2/admin/updateMenuAndActions',
    method: 'post',
    data
}) 